package com.yzc.android.network.mock;

import com.google.gson.Gson;

/**
 * Created by yzc on 16/5/5.
 */
public class GsonMapResponse implements IFakeResponse {

    private Object mResponse;
    private int mHttpcode = 200;
    private Gson mGson = new Gson();

    public GsonMapResponse() {
    }

    public GsonMapResponse(Object response, int httpCode) {
        mResponse = response;
        mHttpcode = httpCode;
    }

    @Override
    public String body() {
        if (mResponse != null)
        {
            return mGson.toJson(mResponse);
        }
        return "";
    }

    @Override
    public String mediaType() {
        return "application/json";
    }

    @Override
    public int httpCode() {
        return mHttpcode;
    }
}
